package com.itheima.dao;

import com.itheima.domain.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface IProductDao {
    /**
     * 查询所有产品
     * @return
     * @throws Exception
     */
    @Select("select * from product")
    public List<Product> findAllProduct()throws Exception;

    /**
     * 添加产品
     * @param product
     * @return
     * @throws Exception
     */
    @Insert("insert into product values(sys_guid(),#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    public int saveProduct(Product product)throws Exception;

    /**
     * 根据产品编号查询产品信息
     * @param id
     * @return
     * @throws Exception
     */
    @Select("select * from product where id = #{id}")
    public Product findProductById(String id)throws Exception;
}
